Option Explicit On
Option Strict On

Imports System
Imports System.Text
Imports System.Collections.Generic
Imports NUnit.Framework

Imports nstl

Namespace nstl.test

    <TestFixture()> _
    Public Class IteratorTest

#Region "Additional test attributes"
        '
        ' You can use the following additional attributes as you write your tests:
        '
        ' Use ClassInitialize to run code before running the first test in the class
        ' <ClassInitialize()> Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
        ' End Sub
        '
        ' Use ClassCleanup to run code after all tests in a class have run
        ' <ClassCleanup()> Public Shared Sub MyClassCleanup()
        ' End Sub
        '
        ' Use TestInitialize to run code before running each test
        ' <SetUp()> Public Sub MyTestInitialize()
        ' End Sub
        '
        ' Use TestCleanup to run code after each test has run
        ' <TearDown()> Public Sub MyTestCleanup()
        ' End Sub
        '
#End Region

        <Test()> _
        Public Sub TestReverseIteratrors()
            Dim v1 As New List(Of Integer)(New Integer() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9})
            Dim v2 As New List(Of Integer)
            Dim v22 As New List(Of Integer)(New Integer() {9, 8, 7, 6, 5, 4, 3, 2, 1, 0})
            Dim v3 As New List(Of Integer)
            Dim v33 As New List(Of Integer)(New Integer() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9})

            Algorithm.Copy(NstlUtil.Reverse(v1.End), NstlUtil.Reverse(v1.Begin), v2.AddInserter())
            Algorithm.Copy(NstlUtil.Reverse(NstlUtil.Reverse(v1.Begin)), NstlUtil.Reverse(NstlUtil.Reverse(v1.End)), v3.AddInserter())

            Assert.IsFalse(TestUtil.mismatch(v2, v22))
            Assert.IsFalse(TestUtil.mismatch(v3, v33))
        End Sub

    End Class

End Namespace
